<?php
//引入连接数据库文件
require_once "./conn.php";
if (isset($_POST['save'])) {
    //收集表单传递的数据
    $username = $_POST['username'];
    $email = $_POST['email'];
    $mobile = $_POST['mobile'];
    //echo $username."---".$email."---".$mobile;
    //构造sql语句插入数据
    $sql = "insert into users(name,email,mobile) values('$username','$email','$mobile')";
    // echo $sql;
    if (mysqli_query($link,$sql)) {
    //当插入成功的时候
        header("Location:index.php");
        exit;
    } else {
        //错误
        echo 'Error'.mysqli_error($link);

    }

    mysqli_colse($link);
}


?>